package reflect;

import reflect.annotation.AutoRunMethod;

import java.lang.reflect.Method;

public class Test5 {
    public static void main(String[] args) throws Exception {
        Class cls = Class.forName("reflect.Person");
        Object obj = cls.newInstance();
        Method[] methods = cls.getMethods();
        for (Method method : methods){
            if (method.isAnnotationPresent(AutoRunMethod.class)){
                AutoRunMethod arm = method.getAnnotation(AutoRunMethod.class);
                for (int i=0;i<arm.value();i++){
                    method.invoke(obj);
                }
            }
        }
    }
}
